import JSEncrypt from "jsencrypt";
import { JxtechLoginUser } from "@/stores/interface/user";
/**
 * 前端rsa加密方式
 * @param account 账号
 * @param password 密码
 * @param publicKey 公钥
 */

export function rsaencode(account: JxtechLoginUser["account"], password: JxtechLoginUser["password"], publicKey: string) {
  const encryptor = new JSEncrypt();
  encryptor.setPublicKey(publicKey);
  return {
    account: "rsa" + encryptor.encrypt(account),
    password: "rsa" + encryptor.encrypt(password)
  };
}
